<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
      <el-form-item label="排序" prop="sortNum">
        <el-input
          v-model="queryParams.sortNum"
          placeholder="请输入排序"
          clearable
          @keyup.enter="handleQuery"
        />
      </el-form-item>
      <el-form-item label="楼盘名称" prop="name">
        <el-input
          v-model="queryParams.name"
          placeholder="请输入楼盘名称"
          clearable
          @keyup.enter="handleQuery"
        />
      </el-form-item>
      <el-form-item label="楼盘图片" prop="headerUrl">
        <el-input
          v-model="queryParams.headerUrl"
          placeholder="请输入楼盘图片"
          clearable
          @keyup.enter="handleQuery"
        />
      </el-form-item>
      <el-form-item label="楼盘类型(1系统龙盘 2公司楼盘 );sass 模式下 有系统楼盘和公司楼盘之分,否则都是公司楼盘" prop="types">
        <el-input
          v-model="queryParams.types"
          placeholder="请输入楼盘类型(1系统龙盘 2公司楼盘 );sass 模式下 有系统楼盘和公司楼盘之分,否则都是公司楼盘"
          clearable
          @keyup.enter="handleQuery"
        />
      </el-form-item>
      <el-form-item label="楼盘所在省份" prop="proviceName">
        <el-input
          v-model="queryParams.proviceName"
          placeholder="请输入楼盘所在省份"
          clearable
          @keyup.enter="handleQuery"
        />
      </el-form-item>
      <el-form-item label="楼盘所在城市" prop="cityName">
        <el-input
          v-model="queryParams.cityName"
          placeholder="请输入楼盘所在城市"
          clearable
          @keyup.enter="handleQuery"
        />
      </el-form-item>
      <el-form-item label="楼盘所在区县" prop="countryName">
        <el-input
          v-model="queryParams.countryName"
          placeholder="请输入楼盘所在区县"
          clearable
          @keyup.enter="handleQuery"
        />
      </el-form-item>
      <el-form-item label="楼盘所在镇" prop="town">
        <el-input
          v-model="queryParams.town"
          placeholder="请输入楼盘所在镇"
          clearable
          @keyup.enter="handleQuery"
        />
      </el-form-item>
      <el-form-item label="省份id" prop="proviceId">
        <el-input
          v-model="queryParams.proviceId"
          placeholder="请输入省份id"
          clearable
          @keyup.enter="handleQuery"
        />
      </el-form-item>
      <el-form-item label="城市id" prop="cityId">
        <el-input
          v-model="queryParams.cityId"
          placeholder="请输入城市id"
          clearable
          @keyup.enter="handleQuery"
        />
      </el-form-item>
      <el-form-item label="区县id" prop="countryId">
        <el-input
          v-model="queryParams.countryId"
          placeholder="请输入区县id"
          clearable
          @keyup.enter="handleQuery"
        />
      </el-form-item>
      <el-form-item label="镇id" prop="townId">
        <el-input
          v-model="queryParams.townId"
          placeholder="请输入镇id"
          clearable
          @keyup.enter="handleQuery"
        />
      </el-form-item>
      <el-form-item label="详细地址" prop="address">
        <el-input
          v-model="queryParams.address"
          placeholder="请输入详细地址"
          clearable
          @keyup.enter="handleQuery"
        />
      </el-form-item>
      <el-form-item label="商圈id" prop="commercialId">
        <el-input
          v-model="queryParams.commercialId"
          placeholder="请输入商圈id"
          clearable
          @keyup.enter="handleQuery"
        />
      </el-form-item>
      <el-form-item label="小区id" prop="xiaoquId">
        <el-input
          v-model="queryParams.xiaoquId"
          placeholder="请输入小区id"
          clearable
          @keyup.enter="handleQuery"
        />
      </el-form-item>
      <el-form-item label="均价，单位：" prop="averagePrice">
        <el-input
          v-model="queryParams.averagePrice"
          placeholder="请输入均价，单位："
          clearable
          @keyup.enter="handleQuery"
        />
      </el-form-item>
      <el-form-item label="二手房 套数" prop="secondHandNum">
        <el-input
          v-model="queryParams.secondHandNum"
          placeholder="请输入二手房 套数"
          clearable
          @keyup.enter="handleQuery"
        />
      </el-form-item>
      <el-form-item label="在租房 套数" prop="rentNum">
        <el-input
          v-model="queryParams.rentNum"
          placeholder="请输入在租房 套数"
          clearable
          @keyup.enter="handleQuery"
        />
      </el-form-item>
      <el-form-item label="楼栋数量" prop="buildingNum">
        <el-input
          v-model="queryParams.buildingNum"
          placeholder="请输入楼栋数量"
          clearable
          @keyup.enter="handleQuery"
        />
      </el-form-item>
      <el-form-item label="户数" prop="householdNum">
        <el-input
          v-model="queryParams.householdNum"
          placeholder="请输入户数"
          clearable
          @keyup.enter="handleQuery"
        />
      </el-form-item>
      <el-form-item label="物业公司" prop="propertyManagementCompany">
        <el-input
          v-model="queryParams.propertyManagementCompany"
          placeholder="请输入物业公司"
          clearable
          @keyup.enter="handleQuery"
        />
      </el-form-item>
      <el-form-item label="物业费" prop="propertyManagementFee">
        <el-input
          v-model="queryParams.propertyManagementFee"
          placeholder="请输入物业费"
          clearable
          @keyup.enter="handleQuery"
        />
      </el-form-item>
      <el-form-item label="物业电话" prop="propertyManagementPhone">
        <el-input
          v-model="queryParams.propertyManagementPhone"
          placeholder="请输入物业电话"
          clearable
          @keyup.enter="handleQuery"
        />
      </el-form-item>
      <el-form-item label="总建筑面积" prop="totalFloorArea">
        <el-input
          v-model="queryParams.totalFloorArea"
          placeholder="请输入总建筑面积"
          clearable
          @keyup.enter="handleQuery"
        />
      </el-form-item>
      <el-form-item label="建筑年代" prop="yearBuilt">
        <el-input
          v-model="queryParams.yearBuilt"
          placeholder="请输入建筑年代"
          clearable
          @keyup.enter="handleQuery"
        />
      </el-form-item>
      <el-form-item label="开发商" prop="developer">
        <el-input
          v-model="queryParams.developer"
          placeholder="请输入开发商"
          clearable
          @keyup.enter="handleQuery"
        />
      </el-form-item>
      <el-form-item label="绿化率(单位 %)" prop="greeningRate">
        <el-input
          v-model="queryParams.greeningRate"
          placeholder="请输入绿化率(单位 %)"
          clearable
          @keyup.enter="handleQuery"
        />
      </el-form-item>
      <el-form-item label="容积率(单位 %)" prop="plotRatio">
        <el-input
          v-model="queryParams.plotRatio"
          placeholder="请输入容积率(单位 %)"
          clearable
          @keyup.enter="handleQuery"
        />
      </el-form-item>
      <el-form-item label="车位数量" prop="parkingSpotNum">
        <el-input
          v-model="queryParams.parkingSpotNum"
          placeholder="请输入车位数量"
          clearable
          @keyup.enter="handleQuery"
        />
      </el-form-item>
      <el-form-item label="户型" prop="huxing">
        <el-input
          v-model="queryParams.huxing"
          placeholder="请输入户型"
          clearable
          @keyup.enter="handleQuery"
        />
      </el-form-item>
      <el-form-item label="置顶(true/false)+更新时间倒序" prop="toTop">
        <el-input
          v-model="queryParams.toTop"
          placeholder="请输入置顶(true/false)+更新时间倒序"
          clearable
          @keyup.enter="handleQuery"
        />
      </el-form-item>
      <el-form-item label="乐观锁" prop="revision">
        <el-input
          v-model="queryParams.revision"
          placeholder="请输入乐观锁"
          clearable
          @keyup.enter="handleQuery"
        />
      </el-form-item>
      <el-form-item label="创建人" prop="createdBy">
        <el-input
          v-model="queryParams.createdBy"
          placeholder="请输入创建人"
          clearable
          @keyup.enter="handleQuery"
        />
      </el-form-item>
      <el-form-item label="创建时间" prop="createdTime">
        <el-date-picker clearable
          v-model="queryParams.createdTime"
          type="date"
          value-format="YYYY-MM-DD"
          placeholder="请选择创建时间">
        </el-date-picker>
      </el-form-item>
      <el-form-item label="更新人" prop="updatedBy">
        <el-input
          v-model="queryParams.updatedBy"
          placeholder="请输入更新人"
          clearable
          @keyup.enter="handleQuery"
        />
      </el-form-item>
      <el-form-item label="更新时间" prop="updatedTime">
        <el-date-picker clearable
          v-model="queryParams.updatedTime"
          type="date"
          value-format="YYYY-MM-DD"
          placeholder="请选择更新时间">
        </el-date-picker>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
        <el-button icon="Refresh" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="Plus"
          @click="handleAdd"
          v-hasPermi="['house:project:add']"
        >新增</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="success"
          plain
          icon="Edit"
          :disabled="single"
          @click="handleUpdate"
          v-hasPermi="['house:project:edit']"
        >修改</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="danger"
          plain
          icon="Delete"
          :disabled="multiple"
          @click="handleDelete"
          v-hasPermi="['house:project:remove']"
        >删除</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="Download"
          @click="handleExport"
          v-hasPermi="['house:project:export']"
        >导出</el-button>
      </el-col>
      <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <el-table v-loading="loading" :data="projectList" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column label="id" align="center" prop="id" />
      <el-table-column label="排序" align="center" prop="sortNum" />
      <el-table-column label="楼盘名称" align="center" prop="name" />
      <el-table-column label="楼盘图片" align="center" prop="headerUrl" />
      <el-table-column label="楼盘类型(1系统龙盘 2公司楼盘 );sass 模式下 有系统楼盘和公司楼盘之分,否则都是公司楼盘" align="center" prop="types" />
      <el-table-column label="楼盘图片json数组" align="center" prop="buildingImgs" />
      <el-table-column label="楼盘所在省份" align="center" prop="proviceName" />
      <el-table-column label="楼盘所在城市" align="center" prop="cityName" />
      <el-table-column label="楼盘所在区县" align="center" prop="countryName" />
      <el-table-column label="楼盘所在镇" align="center" prop="town" />
      <el-table-column label="省份id" align="center" prop="proviceId" />
      <el-table-column label="城市id" align="center" prop="cityId" />
      <el-table-column label="区县id" align="center" prop="countryId" />
      <el-table-column label="镇id" align="center" prop="townId" />
      <el-table-column label="详细地址" align="center" prop="address" />
      <el-table-column label="商圈id" align="center" prop="commercialId" />
      <el-table-column label="小区id" align="center" prop="xiaoquId" />
      <el-table-column label="均价，单位：" align="center" prop="averagePrice" />
      <el-table-column label="二手房 套数" align="center" prop="secondHandNum" />
      <el-table-column label="在租房 套数" align="center" prop="rentNum" />
      <el-table-column label="楼栋数量" align="center" prop="buildingNum" />
      <el-table-column label="户数" align="center" prop="householdNum" />
      <el-table-column label="类型：标准写字楼、商住两用..." align="center" prop="buildingType" />
      <el-table-column label="物业公司" align="center" prop="propertyManagementCompany" />
      <el-table-column label="物业费" align="center" prop="propertyManagementFee" />
      <el-table-column label="物业电话" align="center" prop="propertyManagementPhone" />
      <el-table-column label="总建筑面积" align="center" prop="totalFloorArea" />
      <el-table-column label="建筑年代" align="center" prop="yearBuilt" />
      <el-table-column label="开发商" align="center" prop="developer" />
      <el-table-column label="绿化率(单位 %)" align="center" prop="greeningRate" />
      <el-table-column label="容积率(单位 %)" align="center" prop="plotRatio" />
      <el-table-column label="车位数量" align="center" prop="parkingSpotNum" />
      <el-table-column label="户型" align="center" prop="huxing" />
      <el-table-column label="置顶(true/false)+更新时间倒序" align="center" prop="toTop" />
      <el-table-column label="乐观锁" align="center" prop="revision" />
      <el-table-column label="创建人" align="center" prop="createdBy" />
      <el-table-column label="创建时间" align="center" prop="createdTime" width="180">
        <template #default="scope">
          <span>{{ parseTime(scope.row.createdTime, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="更新人" align="center" prop="updatedBy" />
      <el-table-column label="更新时间" align="center" prop="updatedTime" width="180">
        <template #default="scope">
          <span>{{ parseTime(scope.row.updatedTime, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
        <template #default="scope">
          <el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['house:project:edit']">修改</el-button>
          <el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['house:project:remove']">删除</el-button>
        </template>
      </el-table-column>
    </el-table>
    
    <pagination
      v-show="total>0"
      :total="total"
      v-model:page="queryParams.pageNum"
      v-model:limit="queryParams.pageSize"
      @pagination="getList"
    />

    <!-- 添加或修改企业录入的楼盘字典对话框 -->
    <el-dialog :title="title" v-model="open" width="500px" append-to-body>
      <el-form ref="projectRef" :model="form" :rules="rules" label-width="80px">
        <el-form-item label="排序" prop="sortNum">
          <el-input v-model="form.sortNum" placeholder="请输入排序" />
        </el-form-item>
        <el-form-item label="楼盘名称" prop="name">
          <el-input v-model="form.name" placeholder="请输入楼盘名称" />
        </el-form-item>
        <el-form-item label="楼盘图片" prop="headerUrl">
          <el-input v-model="form.headerUrl" placeholder="请输入楼盘图片" />
        </el-form-item>
        <el-form-item label="楼盘类型(1系统龙盘 2公司楼盘 );sass 模式下 有系统楼盘和公司楼盘之分,否则都是公司楼盘" prop="types">
          <el-input v-model="form.types" placeholder="请输入楼盘类型(1系统龙盘 2公司楼盘 );sass 模式下 有系统楼盘和公司楼盘之分,否则都是公司楼盘" />
        </el-form-item>
        <el-form-item label="楼盘图片json数组" prop="buildingImgs">
          <el-input v-model="form.buildingImgs" type="textarea" placeholder="请输入内容" />
        </el-form-item>
        <el-form-item label="楼盘所在省份" prop="proviceName">
          <el-input v-model="form.proviceName" placeholder="请输入楼盘所在省份" />
        </el-form-item>
        <el-form-item label="楼盘所在城市" prop="cityName">
          <el-input v-model="form.cityName" placeholder="请输入楼盘所在城市" />
        </el-form-item>
        <el-form-item label="楼盘所在区县" prop="countryName">
          <el-input v-model="form.countryName" placeholder="请输入楼盘所在区县" />
        </el-form-item>
        <el-form-item label="楼盘所在镇" prop="town">
          <el-input v-model="form.town" placeholder="请输入楼盘所在镇" />
        </el-form-item>
        <el-form-item label="省份id" prop="proviceId">
          <el-input v-model="form.proviceId" placeholder="请输入省份id" />
        </el-form-item>
        <el-form-item label="城市id" prop="cityId">
          <el-input v-model="form.cityId" placeholder="请输入城市id" />
        </el-form-item>
        <el-form-item label="区县id" prop="countryId">
          <el-input v-model="form.countryId" placeholder="请输入区县id" />
        </el-form-item>
        <el-form-item label="镇id" prop="townId">
          <el-input v-model="form.townId" placeholder="请输入镇id" />
        </el-form-item>
        <el-form-item label="详细地址" prop="address">
          <el-input v-model="form.address" placeholder="请输入详细地址" />
        </el-form-item>
        <el-form-item label="商圈id" prop="commercialId">
          <el-input v-model="form.commercialId" placeholder="请输入商圈id" />
        </el-form-item>
        <el-form-item label="小区id" prop="xiaoquId">
          <el-input v-model="form.xiaoquId" placeholder="请输入小区id" />
        </el-form-item>
        <el-form-item label="均价，单位：" prop="averagePrice">
          <el-input v-model="form.averagePrice" placeholder="请输入均价，单位：" />
        </el-form-item>
        <el-form-item label="二手房 套数" prop="secondHandNum">
          <el-input v-model="form.secondHandNum" placeholder="请输入二手房 套数" />
        </el-form-item>
        <el-form-item label="在租房 套数" prop="rentNum">
          <el-input v-model="form.rentNum" placeholder="请输入在租房 套数" />
        </el-form-item>
        <el-form-item label="楼栋数量" prop="buildingNum">
          <el-input v-model="form.buildingNum" placeholder="请输入楼栋数量" />
        </el-form-item>
        <el-form-item label="户数" prop="householdNum">
          <el-input v-model="form.householdNum" placeholder="请输入户数" />
        </el-form-item>
        <el-form-item label="物业公司" prop="propertyManagementCompany">
          <el-input v-model="form.propertyManagementCompany" placeholder="请输入物业公司" />
        </el-form-item>
        <el-form-item label="物业费" prop="propertyManagementFee">
          <el-input v-model="form.propertyManagementFee" placeholder="请输入物业费" />
        </el-form-item>
        <el-form-item label="物业电话" prop="propertyManagementPhone">
          <el-input v-model="form.propertyManagementPhone" placeholder="请输入物业电话" />
        </el-form-item>
        <el-form-item label="总建筑面积" prop="totalFloorArea">
          <el-input v-model="form.totalFloorArea" placeholder="请输入总建筑面积" />
        </el-form-item>
        <el-form-item label="建筑年代" prop="yearBuilt">
          <el-input v-model="form.yearBuilt" placeholder="请输入建筑年代" />
        </el-form-item>
        <el-form-item label="开发商" prop="developer">
          <el-input v-model="form.developer" placeholder="请输入开发商" />
        </el-form-item>
        <el-form-item label="绿化率(单位 %)" prop="greeningRate">
          <el-input v-model="form.greeningRate" placeholder="请输入绿化率(单位 %)" />
        </el-form-item>
        <el-form-item label="容积率(单位 %)" prop="plotRatio">
          <el-input v-model="form.plotRatio" placeholder="请输入容积率(单位 %)" />
        </el-form-item>
        <el-form-item label="车位数量" prop="parkingSpotNum">
          <el-input v-model="form.parkingSpotNum" placeholder="请输入车位数量" />
        </el-form-item>
        <el-form-item label="户型" prop="huxing">
          <el-input v-model="form.huxing" placeholder="请输入户型" />
        </el-form-item>
        <el-form-item label="置顶(true/false)+更新时间倒序" prop="toTop">
          <el-input v-model="form.toTop" placeholder="请输入置顶(true/false)+更新时间倒序" />
        </el-form-item>
        <el-form-item label="乐观锁" prop="revision">
          <el-input v-model="form.revision" placeholder="请输入乐观锁" />
        </el-form-item>
        <el-form-item label="创建人" prop="createdBy">
          <el-input v-model="form.createdBy" placeholder="请输入创建人" />
        </el-form-item>
        <el-form-item label="创建时间" prop="createdTime">
          <el-date-picker clearable
            v-model="form.createdTime"
            type="date"
            value-format="YYYY-MM-DD"
            placeholder="请选择创建时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="更新人" prop="updatedBy">
          <el-input v-model="form.updatedBy" placeholder="请输入更新人" />
        </el-form-item>
        <el-form-item label="更新时间" prop="updatedTime">
          <el-date-picker clearable
            v-model="form.updatedTime"
            type="date"
            value-format="YYYY-MM-DD"
            placeholder="请选择更新时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="0 表示未删除，1 表示已逻辑删除" prop="delFlag">
          <el-input v-model="form.delFlag" placeholder="请输入0 表示未删除，1 表示已逻辑删除" />
        </el-form-item>
      </el-form>
      <template #footer>
        <div class="dialog-footer">
          <el-button type="primary" @click="submitForm">确 定</el-button>
          <el-button @click="cancel">取 消</el-button>
        </div>
      </template>
    </el-dialog>
  </div>
</template>

<script setup name="Project">
import { listProject, getProject, delProject, addProject, updateProject } from "@/api/house/project"

const { proxy } = getCurrentInstance()

const projectList = ref([])
const open = ref(false)
const loading = ref(true)
const showSearch = ref(true)
const ids = ref([])
const single = ref(true)
const multiple = ref(true)
const total = ref(0)
const title = ref("")

const data = reactive({
  form: {},
  queryParams: {
    pageNum: 1,
    pageSize: 10,
    sortNum: null,
    name: null,
    headerUrl: null,
    types: null,
    buildingImgs: null,
    proviceName: null,
    cityName: null,
    countryName: null,
    town: null,
    proviceId: null,
    cityId: null,
    countryId: null,
    townId: null,
    address: null,
    commercialId: null,
    xiaoquId: null,
    averagePrice: null,
    secondHandNum: null,
    rentNum: null,
    buildingNum: null,
    householdNum: null,
    buildingType: null,
    propertyManagementCompany: null,
    propertyManagementFee: null,
    propertyManagementPhone: null,
    totalFloorArea: null,
    yearBuilt: null,
    developer: null,
    greeningRate: null,
    plotRatio: null,
    parkingSpotNum: null,
    huxing: null,
    toTop: null,
    revision: null,
    createdBy: null,
    createdTime: null,
    updatedBy: null,
    updatedTime: null,
  },
  rules: {
  }
})

const { queryParams, form, rules } = toRefs(data)

/** 查询企业录入的楼盘字典列表 */
function getList() {
  loading.value = true
  listProject(queryParams.value).then(response => {
    projectList.value = response.rows
    total.value = response.total
    loading.value = false
  })
}

// 取消按钮
function cancel() {
  open.value = false
  reset()
}

// 表单重置
function reset() {
  form.value = {
    id: null,
    sortNum: null,
    name: null,
    headerUrl: null,
    types: null,
    buildingImgs: null,
    proviceName: null,
    cityName: null,
    countryName: null,
    town: null,
    proviceId: null,
    cityId: null,
    countryId: null,
    townId: null,
    address: null,
    commercialId: null,
    xiaoquId: null,
    averagePrice: null,
    secondHandNum: null,
    rentNum: null,
    buildingNum: null,
    householdNum: null,
    buildingType: null,
    propertyManagementCompany: null,
    propertyManagementFee: null,
    propertyManagementPhone: null,
    totalFloorArea: null,
    yearBuilt: null,
    developer: null,
    greeningRate: null,
    plotRatio: null,
    parkingSpotNum: null,
    huxing: null,
    toTop: null,
    revision: null,
    createdBy: null,
    createdTime: null,
    updatedBy: null,
    updatedTime: null,
    delFlag: null
  }
  proxy.resetForm("projectRef")
}

/** 搜索按钮操作 */
function handleQuery() {
  queryParams.value.pageNum = 1
  getList()
}

/** 重置按钮操作 */
function resetQuery() {
  proxy.resetForm("queryRef")
  handleQuery()
}

// 多选框选中数据
function handleSelectionChange(selection) {
  ids.value = selection.map(item => item.id)
  single.value = selection.length != 1
  multiple.value = !selection.length
}

/** 新增按钮操作 */
function handleAdd() {
  reset()
  open.value = true
  title.value = "添加企业录入的楼盘字典"
}

/** 修改按钮操作 */
function handleUpdate(row) {
  reset()
  const _id = row.id || ids.value
  getProject(_id).then(response => {
    form.value = response.data
    open.value = true
    title.value = "修改企业录入的楼盘字典"
  })
}

/** 提交按钮 */
function submitForm() {
  proxy.$refs["projectRef"].validate(valid => {
    if (valid) {
      if (form.value.id != null) {
        updateProject(form.value).then(response => {
          proxy.$modal.msgSuccess("修改成功")
          open.value = false
          getList()
        })
      } else {
        addProject(form.value).then(response => {
          proxy.$modal.msgSuccess("新增成功")
          open.value = false
          getList()
        })
      }
    }
  })
}

/** 删除按钮操作 */
function handleDelete(row) {
  const _ids = row.id || ids.value
  proxy.$modal.confirm('是否确认删除企业录入的楼盘字典编号为"' + _ids + '"的数据项？').then(function() {
    return delProject(_ids)
  }).then(() => {
    getList()
    proxy.$modal.msgSuccess("删除成功")
  }).catch(() => {})
}

/** 导出按钮操作 */
function handleExport() {
  proxy.download('house/project/export', {
    ...queryParams.value
  }, `project_${new Date().getTime()}.xlsx`)
}

getList()
</script>
